package com.bianguo.android.functiondemo.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bianguo.android.functiondemo.R;

import java.util.ArrayList;

import butterknife.BindView;

public class ListViewAdapter extends BaseListAdapter<String> {

    public ListViewAdapter(Context mContext, ArrayList<String> list) {
        super(mContext, list);
    }

    @Override
    public View bindView(int position, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder = null;
        if (view == null) {
            view = inflater.inflate(R.layout.item_list_view_adapter, viewGroup, false);
            viewHolder = new ViewHolder(view);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }
        viewHolder.contentTv.setText(list.get(position));
        return view;
    }

    public static class ViewHolder extends BaseListHolder {

        @BindView(R.id.item_list_view_content)
        TextView contentTv;

        public ViewHolder(View itemView) {
            super(itemView);
        }
    }
}
